package com.dayuanit.dy14.enter.dy14enter1024.dto;

public class ResponseDTO {
    private static final int success_code = 1000;
    private static final int error_code = 9999;
    private static final int un_login_code = 5555;

    private int code = success_code;
    private String msg;
    private Object data;

    private ResponseDTO() {}

    private ResponseDTO(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private ResponseDTO(int code) {
        this.code = code;
        this.msg = "";
    }

    private ResponseDTO(int code, Object data) {
        this.code = code;
        this.data = data;
    }

    private ResponseDTO(Object data) {
        this.data = data;
    }

    public static ResponseDTO success() {
        return new ResponseDTO();
    }

    public static ResponseDTO success(Object data) {
        return new ResponseDTO(data);
    }

    public static ResponseDTO fail(String msg) {
        return new ResponseDTO(error_code, msg);
    }

    public static ResponseDTO unLogin(String msg) {
        return new ResponseDTO(un_login_code, msg);
    }

    public Object getData() {
        return data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
